xend: Make hotplug script timeouts configurable
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 19 May 2009 01:18:48 +0000 (02:18 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 19 May 2009 01:18:48 +0000 (02:18 +0100)
In some configurations, when dom0 is busy with I/O, it may take
several minutes to complete all hotplug scripts required when a new
domain is being created. As device create timeout is set to 100
seconds, users get "hotplug scripts not working" error instead of a
new domain.

This patch makes both DEVICE_CREATE_TIMEOUT and DEVICE_DESTROY_TIMEOUT
configurable in xend-config.sxp to allow users to easily adapt hotplug
timeouts to their environment.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
docs/man/xend-config.sxp.pod.5
tools/examples/xend-config.sxp
tools/python/xen/xend/XendOptions.py
tools/python/xen/xend/server/DevConstants.py

index 3851bba3b46793ae97c09215e7923b4af93a6c4b..9504c71fedc80017c11dd8612c464b2f2310e6df 100644 (file)
@@ -115,6 +115,16 @@ The name of an application or script that can handle external device
 migration, such as for example virtual TPM migration. An example
 script is I</etc/xen/scripts/external-device-migrate>.
 
+=item I<device-create-timeout>
+
+Integer value that tells xend how long it should wait for a new device
+to be created. Defaults to I<100>.
+
+=item I<device-destroy-timeout>
+
+Integer value that tells xend how long it should wait for a device to
+be destroyed. Defaults to I<100>.
+
 =back
 
 =head1 EXAMPLES
index 7ca270661a0f5b442ac7a11f4abb56697390e500..a1d8c85fa3e909f2b9d1ddd6fd7e7988bc425d9b 100644 (file)
 # Path where persistent domain configuration is stored.
 # Default is /var/lib/xend/domains/
 #(xend-domains-path /var/lib/xend/domains)
+
+# Number of seconds xend will wait for device creation and
+# destruction
+#(device-create-timeout 100)
+#(device-destroy-timeout 100)
+
index b507f9b3b710627051f3ea25f91b6fae51e34ffc..edd16221e500e66e3ebf0a309f22c1189aaef201 100644 (file)
@@ -141,6 +141,12 @@ class XendOptions:
     """Default rotation count of qemu-dm log file."""
     qemu_dm_logrotate_count = 10
 
+    """Default timeout for device creation."""
+    device_create_timeout_default = 100
+
+    """Default timeout for device destruction."""
+    device_destroy_timeout_default = 100
+
     def __init__(self):
         self.configure()
 
@@ -368,6 +374,14 @@ class XendOptions:
         return self.get_config_int("qemu-dm-logrotate-count",
                                    self.qemu_dm_logrotate_count)
 
+    def get_device_create_timeout(self):
+        return self.get_config_int("device-create-timeout",
+                                   self.device_create_timeout_default)
+
+    def get_device_destroy_timeout(self):
+        return self.get_config_int("device-destroy-timeout",
+                                   self.device_destroy_timeout_default)
+
 
 class XendOptionsFile(XendOptions):
 
index ba7abfc7a954370729c737eea9c1c53344d1adc1..ed5fd2978c14af85f6817dae6874adbd1d544067 100644 (file)
 # Copyright (C) 2005 XenSource Ltd
 #============================================================================
 
-DEVICE_CREATE_TIMEOUT  = 100
-DEVICE_DESTROY_TIMEOUT = 100
+from xen.xend import XendOptions
+
+xoptions = XendOptions.instance()
+
+DEVICE_CREATE_TIMEOUT  = xoptions.get_device_create_timeout();
+DEVICE_DESTROY_TIMEOUT = xoptions.get_device_destroy_timeout();
 HOTPLUG_STATUS_NODE = "hotplug-status"
 HOTPLUG_ERROR_NODE  = "hotplug-error"
 HOTPLUG_STATUS_ERROR = "error"